home *** CD-ROM | disk | FTP | other *** search
- Python image file handling, version 1.3 dated XXXXXXX
- -------------------------------------------------------
-
- This directory contains the source to a number of python modules (both
- in C and in python) that support handling of many different image
- formats. The modules have been tested on an SGI running Irix 6.3 and
- on a Mac running System 7.5, with python 1.4. They should
- be portable, though. All the C-modules should by dynamically loadable.
- If you have the new importdl.c that allows multiple modules to live in
- one .so file you can use that, but it is also possible to create an
- .so file per module.
-
- Mac users can download prebuilt dynamically loadable modules via
- <http://www.cwi.nl/~jack/macpython.html>.
-
- Changes since 1.2
- ------------------
-
- - PNG support
- - BMP support
- - XBM support
- - imgop.unpack() method for unpacking multiple pixels per byte
- - bug fixes
-
- Other stuff needed
- ------------------
-
- The modules need a number of freely available libraries: the pbmplus
- library, the tiff library, the IJG JPEG library and the PNG and ZLIB
- libraries. For Mac users I have made versions of these libraries
- available with project files and such, see
- http://www.cwi.nl/~jack/macsoftware.html. For others you can find the
- more-or-less original sources (with one exception: see below) at
- ftp://ftp.cwi/nl/pub/jack/python-img (where you can also find this
- distribution).
-
- Since the pbmplus error handling is not well-suited for use in python
- it has been modified. The pbmplus sources mentioned above contain that
- fix. Alternatively, you can get libpbm1.c.diff.Z, which contains the
- context diff of the fix. The fix, incidentally, is backward
- compatible. If you don't want the fix you should #undef PBMNEWERROR in
- imgp[pgb]mmodule.c. The effect of this is that an error in your pbm
- file will terminate python.
-
- When you compile the libraries take care that you use the same C
- compiler as for the python distribution.
-
- Building
- --------
-
- The modules build like standard extension modules, see Guido's
- documentation on "Extending and embedding the Python
- Interpreter". Here's a quick guide for Unix:
-
- - Build the jpeg, tiff, pbm, zlib and png libraries.
- - Copy Setup.in to Setup and modify it. You have to provide the paths
- to the libraries needed, and you may want to set BASESETUP and
- BASELIB. Also, SGI users should check the comment near where the
- imgjpeg module is declared, the builtin jpeg module conflicts with
- the cl module (but a python wrapper with the same functionality is
- provided).
- - Build a Makefile, with something like
- make -f Makefile.pre.in boot
-
- Testing
- -------
-
- Go to the test directory and run 'python testimg.py'. This will read
- the images in the files starting with 'in-' and produce a number of
- files starting with 'out-'. For some image formats, it will also check
- that the data read is what is expected, but this cannot be done for
- all formats. So, use 'xv' or some other tool to confirm that the
- images all look as they should. For example 'out-rgb-b2t.ppm' should
- be a ppm file containing a full-color image, upside down. And, yes,
- the fella in the NOFX t-shirt is me (two years ago: remove hair and
- glasses and fade the T-shirt for a more up-to-date view).
-
- There is one warning the test script can currently legally produce:
- about the upper byte of SGI RGB images being changed. Ignore it.
-
- There is a second test program: xtestview.py. It will test
- the image converters by reading each file given on the command line
- and displaying it using X. You can specify the visual and depth to
- use, check the source. In the display window you can type
- Q to go to the next image or W to go to the next image after
- attempting to convert the image back to the original format (the
- result is a file starting with '@copy-').
-
- The third test program, testview.py, is an SGI-only version of
- xtestview.py using GL window calls.
-
- Documentation
- -------------
-
- Yes, there is documentation! Copy the file doc/libimg.tex to your
- python Doc directory and modify lib.tex to include it. There's some
- stuff in the doc directory as well to help you creating documentation
- for the img modules only as well.
-
- Hacking
- -------
-
- You are hereby cordially invited to extend the functionality of the
- image stuff. If you already have support for some image fileformat and
- want to make it available with the interface here look at imgpxxx.py.
- If you want to write a module for some fileformat in C look at
- imgxxxmodule.c. If you want to add an internal format look at
- imgformatmodule.c and imgconvert.py.
-
- Things I am very interested in:
- - Support for more image formats.
- - A colormapper that produces reasonable quality without being as
- doggish as the FS mapper included
- - A better greyscale to monochrome converter.
-
- Authors
- -------
-
- The modules here were written by Jack Jansen and Sjoerd Mullender,
- Centrum voor Wiskunde en Informatica.
-
- Some code in various modules was modified from code available to the
- public, so parts of the code were written (and possibly copyrighted)
- by Jeff Poskanzer, Sun Microsystems, Patrick J. Naughton, David
- Koblas, David Rowley, Marcel Wijkstra, CompuServe Incorporated,
- Spencer W. Thomas, Jim McKie, Steve Davies, Ken Turkowski, James
- A. Woods and Joe Orost. The relevant source files have the exact
- attribution and copyright status.
-
- Complaints, bugs, fixes and other remarks can be sent to
- jack@cwi.nl. I'm especially interested in feedback on the interface,
- maybe we could discuss it in image-sig@python.org, or comp.lang.python
- alias the python-list@cwi.nl.
-
- Jack Jansen
- CWI
- August 1995.
-
-